﻿using System;
using System.ComponentModel;
using System.Linq;
using ProjectEuler.Extensions;
using ProjectEuler.Linq;

namespace ProjectEuler.Problems
{
    [EulerProblem(16, 1366)]
    [Description("What is the sum of the digits of the number 2^1000?")]
    internal sealed class Problem016 : EulerProblem
    {
        public override Object Solve()
        {
            var buffer = new Int32[310];
            buffer[buffer.Length - 1] = 1;

            for (int i = 1; i <= 1000; i++)
            {
                buffer = DecimalArithmetic.LongMultiplication(buffer, new[] { 2 });
            }

            return buffer.Sum();
        }
    }
}
